package com.black.app.domain.req.my.mydata;

import cn.hutool.core.util.StrUtil;
import com.black.common.core.domain.page.PageAbstructReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * ClassName: AppMyDataWeightDetail
 * Package: com.black.app.domain.resp.my.mydata
 * Description:
 *
 * @Author luo
 * @Create 2024/10/24 15:38
 * @Version 1.0
 */
@ApiModel(value = "AppMyDataWeightDetailReq", description = "添加体重记录详情请求参数")
@Data
@ToString(callSuper = true)
public class AppMyDataWeightDetailAddReq extends PageAbstructReq {
    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id",hidden = true)
    private Long userId;

    /**
     * 日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "日期")
    private Date date = new Date();

    /**
     * 开始体重
     */
    @ApiModelProperty(value = "开始体重")
//    @NotNull(message = "体重不能为空")
    private Double stateData = 120.0;

    /**
     * 结束体重
     */
    @ApiModelProperty(value = "结束体重", hidden = true)
    private Double endData;

    /**
     * 类型（8种其一）
     * 隐藏掉
     */
    @ApiModelProperty(value = "类型（8种其一）", hidden = true)
    @NotNull(message = "类型不能为空")
    private String type = "ti";

    @ApiModelProperty(hidden = true)
    @Override
    public String getOrderBy() {
        if (StrUtil.isNotEmpty(super.getOrderByColumn())) {
            return super.getOrderByColumn() + " " + super.getIsAsc();
        }
        return null;
    }

}
